import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
// 导入字体图标
// import './assets/fonts/iconfont.css'
// 导入全局样式表
import './assets/css/global.css'
// 导入全局函数
import common from './assets/js/common.js'
// 导入复制功能
import VueClipboard from 'vue-clipboard2'
// 导入全局变量模块
import global_ from '@/components/Global'
// 导入富文本编辑器
import VueQuillEditor from 'vue-quill-editor'
import 'quill/dist/quill.core.css' // import styles
import 'quill/dist/quill.snow.css' // for snow theme
import 'quill/dist/quill.bubble.css' // for bubble theme
//加入以下引用
import Quill from "quill";
import { ImageDrop } from "quill-image-drop-module";
import ImageResize from "quill-image-resize-module"; // 引用
Quill.register("modules/imageDrop", ImageDrop);
Quill.register("modules/imageResize", ImageResize); // 注册

import * as config from '../static/config.js'

import axios from 'axios'

import qs from 'qs'
// 配置请求的根路径
console.log(config)
axios.defaults.baseURL = config.baseURL

// axios请求拦截
axios.interceptors.request.use(config => {
    // console.log(config)
    // 为请求对象，添加 Token 验证的 Authorization 字段
    var token = window.sessionStorage.getItem('token')
    // console.log(token)
    if (token) {
        config.headers.common['SANTAI-TOKEN'] = token
    }
    // config.headers.Authorization = window.sessionStorage.getItem('token')
    // 在最后必须return config
    // console.log(config)
    return config
})

Vue.prototype.$http = axios
Vue.prototype.qs = qs
Vue.prototype.GLOBAL = global_
Vue.config.productionTip = false

Vue.use(common)
Vue.use(VueClipboard)
Vue.use(VueQuillEditor)

new Vue({
    router,
    render: h => h(App)
}).$mount('#app')
